package com.rede.didiok.rank.controller;

import java.util.Arrays;
import java.util.Map;

// import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.rede.didiok.rank.entity.MemberContentEntity;
import com.rede.didiok.rank.service.MemberContentService;
import com.rede.didiok.common.utils.PageUtils;
import com.rede.didiok.common.utils.R;



/**
 * 榜单成员详情内容表
 *
 * @author Rede
 * @email didiok@foxmail.com
 * @date 2023-07-20 22:09:24
 */
@RestController
@RequestMapping("rank/membercontent")
public class MemberContentController {
    @Autowired
    private MemberContentService memberContentService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    // @RequiresPermissions("rank:membercontent:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = memberContentService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    // @RequiresPermissions("rank:membercontent:info")
    public R info(@PathVariable("id") Long id){
		MemberContentEntity memberContent = memberContentService.getById(id);

        return R.ok().put("memberContent", memberContent);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    // @RequiresPermissions("rank:membercontent:save")
    public R save(@RequestBody MemberContentEntity memberContent){
		memberContentService.save(memberContent);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    // @RequiresPermissions("rank:membercontent:update")
    public R update(@RequestBody MemberContentEntity memberContent){
		memberContentService.updateById(memberContent);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    // @RequiresPermissions("rank:membercontent:delete")
    public R delete(@RequestBody Long[] ids){
		memberContentService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
